package site.codeyin.javautils.controller.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author <a href="https://github.com/liangcheng2221">yinjie</a>
 * @date 2024-11-16 16:36
 */
@Configuration
public class ThreadConfig {


    /**
     * 下载文件所需要的线程池
     *
     * @return 文件下载的线程池对象
     */
    @Bean(value = "downloadExecutorService")
    public ThreadPoolExecutor downloadExecutorService() {
        return new ThreadPoolExecutor(15
                , 15
                , 1L
                , TimeUnit.SECONDS
                , new LinkedBlockingQueue<>(10000));
    }
}
